package com.five.calendar.ui.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;

import com.andexert.library.RippleView;

/**
 * @function水波纹实现
 */
public class RippleViewCompact extends RippleView {

    private OnRippleCompleteListener mListener;

    public RippleViewCompact(Context context) {
        super(context);
    }

    public RippleViewCompact(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public RippleViewCompact(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public void setOnRippleCompleteListener(OnRippleCompleteListener listener) {
        super.setOnRippleCompleteListener(listener);
        mListener = listener;
    }

    @Override
    public void draw(Canvas canvas) {
        try {
            super.draw(canvas);
        } catch (Exception e) {
            if (null != mListener) {
                mListener.onComplete(this);
            }
        }

    }
}
